from selenium.webdriver.common.by import By
from time import sleep

class TranRecord_tt():

    def __init__(self, driver):
        # 交易查询/交易记录
        driver.find_element(By.XPATH,
                            '/html/body/div/div/div[2]/div/div/div[2]/div[1]/div[2]/div[2]/ul/li[1]/a').click()
        # 点击第一个时间栏
        driver.find_element(By.XPATH,
                            '/html/body/div[1]/div/div[2]/div/div/div[1]/div/div[3]/ul/li[1]/div[2]/input[1]').click()
        # 进入时间栏
        self.driver = driver.find_element(By.XPATH, '/html/body/div[2]/div[1]/div/div')

    def help(self):
        print('''action.find_element(By.XPATH, 'div[1]/a[1]')     # 向前
        action.find_element(By.XPATH, 'div[1]/a[2]') # 当前数据/跳回月份选择/跳回年份选择
        action.find_element(By.XPATH, 'div[1]/a[3]') # 向后
        action.find_element(By.XPATH, 'div[2]/div[2]/a[1-42]')    # 日期选择[1-42]
        action.find_element(By.XPATH, 'div[2]/div[1]/a[1-12]')    # 月份选择[1-12]
        action.find_element(By.XPATH, 'div[2]/div[1]/a[1-12]')    # 年份选择[1-12](只有2-11可用)''')

    def tr_timetable_func(self, site):
        self.driver.find_element(By.XPATH, site).click()

    def tr_timetable_check(self, site):
        return self.driver.find_element(By.XPATH, site).text




